clear; clc; close all;

a = 0.1;
b = 0.1;
c = 0;       % Fig.9(a)中 c=0
k = 1.85;    % 固定 k=1.85

ICs = [
    0.1,  10;   % 绿色
    0.1,  3;    % 蓝色
    0.1,  0;    % 青色
    0.1, -5;    % 红色
];
colors = {'g','b','c','m'};  % 对应四条轨迹的颜色

% 迭代步数
N_transient = 50000;   % 暂态步数
N_plot = 40000;        % 用于绘制的步数

% 创建图窗并设置子图
hold on; grid on;
xlabel('x'); ylabel('q');
title('共存吸引子 (c=0, k=1.85)');

for i = 1:size(ICs,1)
    x = ICs(i,1);
    q = ICs(i,2);
    % 先迭代暂态步
    for t = 1:N_transient
        [x, q] = mptm(x, q, a, b, c, k);
    end
    
    % 再记录后续 N_plot 步的轨迹，用于绘制
    orbit_x = zeros(1, N_plot);
    orbit_q = zeros(1, N_plot);
    orbit_x(1) = x;
    orbit_q(1) = q;
    for t = 2:N_plot
        [orbit_x(t), orbit_q(t)] = mptm(orbit_x(t-1), orbit_q(t-1), a, b, c, k);
    end
    
    % 绘制该初始条件下的轨迹
    plot(orbit_x, orbit_q, '.', 'Color', colors{i}, 'MarkerSize', 3);

end
